<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
    function largeGroupPositions(s){
        const ret=[],len=s.length
        let same=s[0],start=0
        for(let i=1;i<=len;i++){
            if(s[i]!==same&&i-start>=3){
                ret.push([start,i-1])
                start=i
                same=s[i]
            }
        }
        return ret
    };
    console.log(largeGroupPositions('aaabbbbbbeeegfmjdksg'))
    </script>
</head>
<body>
    
</body>
</html>